/*******************************************************************************
 * Copyright (c) 2002, 2014 IBM Corp. and others
 *
 * This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License 2.0 which accompanies this
 * distribution and is available at https://www.eclipse.org/legal/epl-2.0/
 * or the Apache License, Version 2.0 which accompanies this distribution and
 * is available at https://www.apache.org/licenses/LICENSE-2.0.
 *
 * This Source Code may also be made available under the following
 * Secondary Licenses when the conditions for such availability set
 * forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
 * General Public License, version 2 with the GNU Classpath
 * Exception [1] and GNU General Public License, version 2 with the
 * OpenJDK Assembly Exception [2].
 *
 * [1] https://www.gnu.org/software/classpath/license.html
 * [2] http://openjdk.java.net/legal/assembly-exception.html
 *
 * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
 *******************************************************************************/
#define true 1
#define false 0
#include "floatsanityg.h"


   void group_java_lang_Math_tan() {
      int i=0, groupNum=48,numTests=132;
      int testsPassed=0, testsFailed=0;
      unsigned int op_0 [] = {
         0x00000000,0x7ff80000, 
         0x00000000,0x7ff00000, 
         0x00000000,0xfff00000, 
         0x0,0x0, 
         0x00000000,0x80000000, 
         0xf95ac4e8,0x3fd58139, 
         0xca24770c,0x3fd4d753, 
         0xe2ee80f8,0x3fe1f1b5, 
         0xb7f0c2cd,0x3fe49c30, 
         0xb0e4050c,0x3fe7d46b, 
         0x09547674,0x3fc0e1f1, 
         0xa53076c8,0x3fd1a461, 
         0x187c4bbf,0x3fe6d154, 
         0xf9d650c2,0x3fe7ba16, 
         0x11a7fd62,0x3fe8ff6c, 
         0x212ad2cc,0x3fda4581, 
         0xe8c22c3c,0x3fd48eb0, 
         0x7edbf5f0,0x3fde27bd, 
         0xdca6b9ac,0x3fc04b98, 
         0x547f8161,0x3fe1d234, 
         0x8232e8e3,0x3fe3af12, 
         0xf31f38d8,0x3fe8cf7c, 
         0x3cd8f2bf,0x3fe87105, 
         0x96cf3360,0x3f932ffb, 
         0x50af46e8,0x3fb378cd, 
         0xd7e968a9,0x3ff921f0, 
         0x54442d18,0xc01921fb, 
         0x54442d1b,0x3ff921fb, 
         0xffffffff,0xffefffff, 
         0xcccccccc,0xffeccccc, 
         0x99999999,0xffe99999, 
         0x66666666,0xffe66666, 
         0x33333333,0xffe33333, 
         0x00000000,0xffe00000, 
         0x9999999a,0xffd99999, 
         0x33333334,0xffd33333, 
         0x9999999c,0xffc99999, 
         0x9999999f,0xffb99999, 
         0x00000000,0xfc980000, 
         0x99999993,0x7fb99999, 
         0x99999996,0x7fc99999, 
         0x33333331,0x7fd33333, 
         0x99999997,0x7fd99999, 
         0xfffffffd,0x7fdfffff, 
         0x33333332,0x7fe33333, 
         0x66666665,0x7fe66666, 
         0x99999998,0x7fe99999, 
         0xcccccccb,0x7feccccc, 
         0xfffffffe,0x7fefffff, 
         0x00000000,0xc32fc000, 
         0xffffffff,0x7fefffff, 
         0x2,0x0, 
         0x9,0x0, 
         0x00000000,0x40000, 
         0x00000000,0x80000, 
         0xfffffffe,0xfffff, 
         0xffffffff,0xfffff, 
         0x00000002,0x80000000, 
         0x00000009,0x80000000, 
         0x00000000,0x80040000, 
         0x00000000,0x80080000, 
         0xfffffffe,0x800fffff, 
         0xffffffff,0x800fffff, 
         0x47ae149b,0x408fb4e1, 
         0xb851eb95,0x4090961e, 
         0x00000000,0xc0863000, 
         0x851eb852,0xc08627eb, 
         0x28f5c132,0x4051ef5c, 
         0x3def12b7,0x3ff0a2b2, 
         0x3e33cae7,0x3ff0a2b2, 
         0x3f8b63d7,0x3ff0a2b2, 
         0xffffffff,0xbfefffff, 
         0xfffffff0,0x3fefffff, 
         0xffffffff,0x3fefffff, 
         0xfffffe14,0x3fefffff, 
         0xc4e8043a,0xc0152c38, 
         0xb06d22f4,0xc014e48a, 
         0x3fc94bea,0xc014da4d, 
         0xcf2574f8,0xc010d00f, 
         0x192c3200,0xc0014e34, 
         0x82c60fb8,0x40124ea8, 
         0xf369e6c2,0x401258e5, 
         0x1c5fa942,0x4014e842, 
         0x0962a17e,0xbff80d0c, 
         0xcbf1fda5,0xbff03601, 
         0x4888e3a9,0x3ff111ac, 
         0x4888e3ab,0x3ff911ac, 
         0x1687291c,0x3fefced9, 
         0x8b439398,0x3fefe76c, 
         0x45a1c8d6,0x3feff3b6, 
         0xd9168540,0x3feff7ce, 
         0x2110f9fe,0xc014eec8, 
         0xb3a09a7b,0x400d7e98, 
         0x2da71340,0xc00295e2, 
         0xf69d5e8e,0x3ffff2f3, 
         0xf369e6ce,0x401058e5, 
         0x4c5f64e4,0xc00e8167, 
         0x4fdf3b6a,0x3fc6978d, 
         0x78d4fdf8,0x3fd126e9, 
         0x4fdf3b69,0x3fd2978d, 
         0x9db22d14,0x3fd6a7ef, 
         0xef9db233,0x3fd7c6a7, 
         0x645a1cb2,0x3fd7df3b, 
         0x9ba5e35a,0x3fd820c4, 
         0x24dd2f21,0x3fd98106, 
         0x645a1cb3,0x3fdbdf3b, 
         0x9ba5e35b,0x3fdc20c4, 
         0xc28f5c30,0x3fdc28f5, 
         0x7ef9db2a,0x3fdcbc6a, 
         0x1cac0839,0x3fdf645a, 
         0x26e978d8,0x3fe00831, 
         0x083126ea,0x3fe01cac, 
         0x5810623c,0x3fe0b439, 
         0x7ef9db10,0x3fe0bc6a, 
         0x353f7cbc,0x3fe1ba5e, 
         0xef9db1fa,0x3fe1c6a7, 
         0xa9fbe738,0x3fe1d2f1, 
         0x3d70a3a2,0x3fe1d70a, 
         0x083126ac,0x3fe21cac, 
         0xe353f782,0x3fe29ba5, 
         0xed916812,0x3fe33f7c, 
         0xdf3b63f0,0x3fe38d4f, 
         0x72b0205a,0x3fe39168, 
         0x9999992e,0x3fe39999, 
         0xba5e34c6,0x3fe40c49, 
         0xae147a4e,0x3fe4e147, 
         0xb22d0da2,0x3fe5ef9d, 
         0x851eb792,0x3fe651eb, 
         0xb439574c,0x3fe676c8, 
         0x4dd2f0b4,0x3fe81062, 
         0x374bc5ac,0x3fe84189, 
         0x126e9644,0x3feac083, 
         0x0, 0x0};
      unsigned int result [] = {
         0x00000000,0x7ff80000, 
         0x00000000,0x7ff80000, 
         0x00000000,0x7ff80000, 
         0x0,0x0, 
         0x00000000,0x80000000, 
         0x2e2e6682,0x3fd65a38, 
         0xeeff3ccb,0x3fd59c46, 
         0x33b68763,0x3fe41899, 
         0x7985e209,0x3fe8073c, 
         0x6427b8e4,0x3fed7ea3, 
         0xde0d7d33,0x3fc0fb2d, 
         0x62f483f6,0x3fd21a5d, 
         0x9df13a74,0x3febacdb, 
         0xe7af2c4c,0x3fed4e14, 
         0xb5b7df9e,0x3fefbb2b, 
         0x67e67156,0x3fdbda96, 
         0xc1d12023,0x3fd54b7a, 
         0xfb2f6f86,0x3fe04d60, 
         0xd9005deb,0x3fc06247, 
         0xbbf60098,0x3fe3ecc5, 
         0xb236f94e,0x3fe69c36, 
         0xed397ec1,0x3fef5ca6, 
         0x21e88dfb,0x3feea582, 
         0xc6c2beae,0x3f93308e, 
         0xf8f3ec07,0x3fb3826f, 
         0x00022921,0x40f86a00, 
         0x33145c07,0x3cb1a626, 
         0xe31272db,0xc3177e2a, 
         0xfe729484,0x3f74530c, 
         0xfd2cea61,0x3feded16, 
         0xc72af18a,0x402bc32a, 
         0x143ea3f4,0xbff3fcd3, 
         0x32203a72,0xbfc32ff7, 
         0x4c0d02a3,0x3fe5ce6b, 
         0xf7ff1c34,0x40116c48, 
         0x141d05f6,0xbffbdc7d, 
         0xef99370c,0xbfd3f9f4, 
         0x4ecbfa28,0xbff3752e, 
         0x73e8b50e,0xc0226c9b, 
         0x4f7457d7,0x3fff5923, 
         0xfaaf88dd,0x3fe24575, 
         0xbe930b1c,0x4009688f, 
         0xa7fc8cf6,0xc000e887, 
         0x5977046e,0xbfd9b43e, 
         0x112492c0,0x401108f3, 
         0xd67b108d,0xbffc2f27, 
         0x3701f38d,0xbfd45350, 
         0xc277c5fa,0x3fde163b, 
         0x970f78b8,0x4003c6e9, 
         0xc4d7c6b2,0xc00a5c27, 
         0xfe729484,0xbf74530c, 
         0x2,0x0, 
         0x9,0x0, 
         0x00000000,0x40000, 
         0x00000000,0x80000, 
         0xfffffffe,0xfffff, 
         0xffffffff,0xfffff, 
         0x00000002,0x80000000, 
         0x00000009,0x80000000, 
         0x00000000,0x80040000, 
         0x00000000,0x80080000, 
         0xfffffffe,0x800fffff, 
         0xffffffff,0x800fffff, 
         0x66e05633,0xbfc00266, 
         0x5a4c53e0,0xbfd5cd22, 
         0x3136287d,0xbf0f9bd0, 
         0x909624bb,0x3ff978cd, 
         0xcd09c84e,0xbfe22dd9, 
         0x5a2991b7,0x3ffb3d8b, 
         0x5b357a7f,0x3ffb3d8b, 
         0x60710665,0x3ffb3d8b, 
         0x5cbee3a4,0xbff8eb24, 
         0x5cbee38a,0x3ff8eb24, 
         0x5cbee3a4,0x3ff8eb24, 
         0x5cbee05b,0x3ff8eb24, 
         0xdcc58f2c,0x3ff860fa, 
         0x0d5ddbea,0x3ffc8d01, 
         0xeb0fc8f7,0x3ffd3b81, 
         0x9e09cda0,0xbffca860, 
         0x6787b299,0x3ff7c5fd, 
         0xc7d83379,0x401d52b8, 
         0xb72d5b9f,0x401fafa0, 
         0xcca5f788,0xbffc4f33, 
         0x0597e0f9,0xc02d8930, 
         0xaef7a0d2,0xbff9a808, 
         0x848e8cdf,0x3ffd033c, 
         0xe84e30aa,0x406f64db, 
         0x2141e404,0x3ff897bc, 
         0xb13ed3d6,0x3ff8c13e, 
         0x0a55e733,0x3ff8d625, 
         0x07973883,0x3ff8dd22, 
         0x982fe51c,0x3ffbe49e, 
         0x56d54bc4,0x3fe368dc, 
         0x3f685075,0x3ff117bf, 
         0x275f25b2,0xc001a0e5, 
         0x7ff7121f,0x3ff62651, 
         0xc42f6d5a,0xbfe96f68, 
         0xe6fab71a,0x3fc6d45d, 
         0x9b3f7f71,0x3fd19325, 
         0x306ccca5,0x3fd3221e, 
         0x16ae58b5,0x3fd7a701, 
         0x2883e8ce,0x3fd8ef0a, 
         0xc686f62b,0x3fd90b5c, 
         0x85d305fb,0x3fd9570d, 
         0xe75268b5,0x3fdaf217, 
         0xa9aac05c,0x3fddc763, 
         0x4c6e73aa,0x3fde1743, 
         0xa61010c4,0x3fde2144, 
         0x471a885a,0x3fded62d, 
         0x46df318d,0x3fe116c7, 
         0xe353789e,0x3fe185f3, 
         0x4b645b89,0x3fe1a09c, 
         0xe3d9ed65,0x3fe26834, 
         0x8d5e19c0,0x3fe2731d, 
         0x2155e7e4,0x3fe3cbc1, 
         0xc05d3c63,0x3fe3dcc2, 
         0x7caf0434,0x3fe3edcc, 
         0x359e192b,0x3fe3f37c, 
         0xb198aa3a,0x3fe454b3, 
         0x445e28b7,0x3fe508b8, 
         0xb0150cf2,0x3fe5f681, 
         0xdbde6382,0x3fe669be, 
         0x626d6550,0x3fe66fda, 
         0xba45daf8,0x3fe67c14, 
         0xedc114d6,0x3fe7291a, 
         0xbe0ffbc0,0x3fe873f8, 
         0x43332eb9,0x3fea2b68, 
         0x22d683a6,0x3fead117, 
         0xd25e6f94,0x3feb1014, 
         0x6fd16dca,0x3fedee4c, 
         0x0e381c87,0x3fee4af9, 
         0x660a72b5,0x3ff1b504, 
         0x0, 0x0};
      double *p0=(double *) op_0;
      double *erp=(double*) result, r, *rp=&r;
      for (i=0; i<numTests; i++) {
         r = java_lang_Math_tan(*(p0));
         if ( IS_DNAN(erp) ){
            if ( !(IS_DNAN(&r)) ){
               printf("%d.%d: op_0=0x%08x%08x Expected=0x%08x%08x Actual=0x%08x%08x \n",
                  groupNum, i, 
                  *((int *)p0+1), *(int *)p0, *((int *) erp + 1), *(int *)erp, *((int *) &r + 1), *(int *)&r);
               testsFailed++;
            } else {
               testsPassed++;
            }

         } else {
            if (HIWORD(&r) != HIWORD(erp) || abs(LOWORD(&r) - LOWORD(erp)) > 1) {
               printf("%d.%d: op_0=0x%08x%08x Expected=0x%08x%08x Actual=0x%08x%08x \n",
                  groupNum, i, 
                  *((int *)p0+1), *(int *)p0, *((int *) erp + 1), *(int *)erp, *((int *) &r + 1), *(int *)&r);
               testsFailed++;
            } else {
               testsPassed++;
            }
         }

         p0++;erp++;
      }
      printf("[%d] %s Passed %d Failed %d Total %d \n", groupNum,"java_lang_Math_tan", testsPassed, testsFailed, numTests);
      totalNumTest +=numTests; totalTestsPassed +=testsPassed; totalTestsFailed +=testsFailed;
   }

